package com.irdstudio.efp.esb.service.impl.hj;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import com.irdstudio.efp.esb.service.bo.req.hj.ReqUnfreezingAccountFundsBean;
import com.irdstudio.efp.esb.service.bo.resp.hj.RespUnfreezingAccountFundsBean;
import com.irdstudio.efp.esb.service.client.ESBClientFactory;
import com.irdstudio.efp.esb.service.client.impl.LhxESBBeanCreator;
import com.irdstudio.efp.esb.service.facade.hj.UnfreezingAccountFundsService;

/**
 * 
 * 账户解冻接口
 * 
 * @author liyakui
 * @since 2019年1月7日 下午8:09:41
 * @version 1.0
 */
@Service("unfreezingAccountFundsService")
public class UnfreezingAccountFundsServiceImpl implements UnfreezingAccountFundsService {

	@Override
	public RespUnfreezingAccountFundsBean unfreezingAccountFunds(ReqUnfreezingAccountFundsBean reqUnfreezingAccountFundsBean)
			throws Exception {
		Logger logger = LoggerFactory.getLogger(UnfreezingAccountFundsServiceImpl.class);
		// 返回对象
		RespUnfreezingAccountFundsBean respUnfreezingAccountFundsBean = null;
		logger.info("前置流水号：" + reqUnfreezingAccountFundsBean.getPrevFlowNo() + "账户解冻接口开始");
		try {
			// 1.调用ESB客户端服务
			respUnfreezingAccountFundsBean = ESBClientFactory.buildClient().withBody(reqUnfreezingAccountFundsBean).withTradeNo("30320004")
					.withScene("02").withESBBeanFactory(LhxESBBeanCreator.getINSTANCE()).create().sendAndReceive()
					.getBody(RespUnfreezingAccountFundsBean.class);
			if ("0000".equals(respUnfreezingAccountFundsBean.getWrongCd())) {
				logger.info("账户解冻接口返回成功！请求参数：" + reqUnfreezingAccountFundsBean + "***********返回结果:" + respUnfreezingAccountFundsBean);

			} else {
				logger.info("账户解冻接口调用失败！返回结果：" + respUnfreezingAccountFundsBean);
			}
		} catch (Exception e) {
			logger.info("调用账户解冻接口失败！" + e.getMessage());
			throw e;
		}

		return respUnfreezingAccountFundsBean;

	}

}
